<?php
defined('SEJUJOPEFDNGJSL') or exit('Access denied');
//if($r['rolename'] == '超级管理员'){
$veid=getnums($_GET['veid'],0);
if(!empty($veid)){
	$db->query('select * from ld_article where id='.$veid,2);
	if(empty($db->rs)){
		show_automsg('文章不存在！',$GLOBALARR['curl'],1);
	}

	echo '<h3>文章阅读</h3>';
	echo '<div class="main-r-body"><div class="artview">
		标题：'.$db->rs['title'].'</div>'.htmlspecialchars_decode($db->rs['content']).'
	</div><a href="javascript:history.go(-1)" class="artreturn">[ 返回 ]</a>';
		exit;
}

$db->query("select count(0) as a from ld_user_account where from_unixtime(regist_time,'%Y-%m-%d')='".date('Y-m-d')."' and id>1",2);
$newuser=$db->rs['a'];
$db->query("select count(0) as a from ld_user_account where is_passed=0",2);
$okuser=$db->rs['a'];
$db->query("select count(0) as a from ld_user_info where from_unixtime(login_time,'%Y-%m-%d')='".date('Y-m-d')."'",2);
$newlogin=$db->rs['a'];
$db->query("select count(0) as a from ld_message where reader_id=0 and from_unixtime(madd_time,'%Y-%m-%d')='".date('Y-m-d')."'",2);
$newemail=$db->rs['a'];
echo '<h3>后台首页</h3>';
echo '<div class="main-r-body">
<div style="width:40%;float:left">
<table class="tregtab ttab">
	<tr>
		<td class="wdb25 alignr paddingr">今日新增会员</td>
		<td class="wdb25 alignc paddingl">'.$newuser.'</td>
		<td class="wdb25 alignr paddingr" valign="top" >待审核会员</td>
		<td class="wdb25 alignc paddingl">'.redtxt($okuser).'</td>		
	</tr>	
	<tr>
		<td class="wdb25 alignr paddingr">今日登录数</td>
		<td class="wdb25 alignc paddingl">'.$newlogin.'</td>
		<td class="wdb25 alignr paddingr" valign="top" >今日邮件数</td>
		<td class="wdb25 alignc paddingl">'.$newemail.'</td>		
	</tr>				
</table>


<table class="tregtab ttab" style="margin-top:25px">';
$sql="select * from ld_article where is_show=0  order by id desc limit 10";
$db->query($sql);
foreach ($db->rs as $k => $v) {
echo '	<tr>
		<td align="left">&nbsp;&nbsp;●&nbsp;<a href="'.UCENTERINDEX.'?lsaction=articlelist&veid='.$v['id'].'" >'.$v['title'].'</a></td>		
	</tr>	';

}
if(empty($db->rs)){
	echo '	<tr>
		<td align="left">&nbsp;&nbsp;您没有任何公告消息!</td>		
	</tr>	';
}
echo '</table>

</div>
<table class="tregtab ttab" style="width:58%;float:left;margin-left:2%">';
$sql="select * from ld_message   where reader_id=0 and read_status=0 and user_name='tianxiayhe' and (delete_state=0 or delete_state=1) order by id desc limit 15";
$db->query($sql);
foreach ($db->rs as $k => $v) {
        $sql="select count(0) from ld_message where delete_state=0 and user_name='tianxiayhe' and reader_id=".$v['id'];
        //echo $sql;exit;
	$db->query($sql,3);
	$yuehf1=$yuehf=$db->fval;	
echo '	<tr>
		<td align="left">&nbsp;&nbsp;●&nbsp;<a  href="'.YMCURL.'yjxview&edid='.$v['id'].'&kan='.$yuehf1.'">'.$v['title'].'</a><span style="color:#888">---['.$v['uname'].']---['.formatdate($v['madd_time'],1).']</span></td>		
	</tr>	';

}
if(empty($db->rs)){
	echo '	<tr>
		<td align="left">&nbsp;&nbsp;您没有任何邮件!</td>		
	</tr>	';
}
echo '</table>

</div>';		
//}
function redtxt($v){
	if($v>0){
		return "<span style='color:#f00'>$v</span>";
	}else{
		return $v;
	}
}
?>